<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="vim,">










<meta name="description" content="简述经常使用liunx开发的话，Linux服务器上面是完全没有图形图画的，所以不能不学vim 你说我有ftp，哈哈，MMP. 使用ssh链接上一个服务器，Linux的命令行输入vim进入，再输入 1:NERDTree 然后就出现了这样一个配置好的一个界面">
<meta name="keywords" content="vim">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux上不得不会的Vim使用及配置">
<meta property="og:url" content="https://xxyuan.net/2018/12/20/Linux上不得不会的Vim使用及配置/index.html">
<meta property="og:site_name" content="晓远Blog">
<meta property="og:description" content="简述经常使用liunx开发的话，Linux服务器上面是完全没有图形图画的，所以不能不学vim 你说我有ftp，哈哈，MMP. 使用ssh链接上一个服务器，Linux的命令行输入vim进入，再输入 1:NERDTree 然后就出现了这样一个配置好的一个界面">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://xxyuan.net/2018/12/20/Linux上不得不会的Vim使用及配置/clipboard.png">
<meta property="og:image" content="https://xxyuan.net/2018/12/20/Linux上不得不会的Vim使用及配置/clipboard1.png">
<meta property="og:image" content="https://xxyuan.net/2018/12/20/Linux上不得不会的Vim使用及配置/clipboard2.png">
<meta property="og:updated_time" content="2019-11-16T14:20:50.096Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Linux上不得不会的Vim使用及配置">
<meta name="twitter:description" content="简述经常使用liunx开发的话，Linux服务器上面是完全没有图形图画的，所以不能不学vim 你说我有ftp，哈哈，MMP. 使用ssh链接上一个服务器，Linux的命令行输入vim进入，再输入 1:NERDTree 然后就出现了这样一个配置好的一个界面">
<meta name="twitter:image" content="https://xxyuan.net/2018/12/20/Linux上不得不会的Vim使用及配置/clipboard.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://xxyuan.net/2018/12/20/Linux上不得不会的Vim使用及配置/">





  <title>Linux上不得不会的Vim使用及配置 | 晓远Blog</title>
  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?b7fbd9803fe7b8df6faf867c7b94ce2a";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">晓远Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://xxyuan.net/2018/12/20/Linux上不得不会的Vim使用及配置/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="晓远">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="晓远Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Linux上不得不会的Vim使用及配置</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-12-20T10:47:50+08:00">
                2018-12-20
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/开发/" itemprop="url" rel="index">
                    <span itemprop="name">开发</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h4 id="简述"><a href="#简述" class="headerlink" title="简述"></a>简述</h4><p>经常使用liunx开发的话，Linux服务器上面是完全没有图形图画的，所以不能不学vim</p>
<p>你说我有ftp，哈哈，MMP.</p>
<p>使用ssh链接上一个服务器，Linux的命令行输入vim进入，再输入</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">:NERDTree</span><br></pre></td></tr></table></figure>
<p>然后就出现了这样一个配置好的一个界面</p>
<p><img src="/2018/12/20/Linux上不得不会的Vim使用及配置/clipboard.png" alt="img"></p>
<a id="more"></a>
<p>在部署一些东西的时候免不了要使用一下编辑器</p>
<p>或者就是为了纯为了装装B，那这个vim也不能不学一下</p>
<h4 id="首先要配置bundel的管理工具"><a href="#首先要配置bundel的管理工具" class="headerlink" title="首先要配置bundel的管理工具"></a>首先要配置bundel的管理工具</h4><p>没安装vim先安装vim和git</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install vim git</span><br></pre></td></tr></table></figure>
<p>安装Vundle</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim</span><br></pre></td></tr></table></figure>
<p>通过脚本我们可以看出来，已经生成Vundle</p>
<h4 id="下一步编写我们配置文件"><a href="#下一步编写我们配置文件" class="headerlink" title="下一步编写我们配置文件"></a>下一步编写我们配置文件</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim ~/.vimrc</span><br></pre></td></tr></table></figure>
<p>配置文件</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br></pre></td><td class="code"><pre><span class="line">set nocompatible</span><br><span class="line">filetype on</span><br><span class="line"> </span><br><span class="line">set rtp+=~/.vim/bundle/Vundle.vim</span><br><span class="line">call vundle#begin()</span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line">" 这里根据自己需要的插件来设置，以下是我的配置 "</span><br><span class="line">"</span><br><span class="line">" YouCompleteMe:语句补全插件</span><br><span class="line">set runtimepath+=~/.vim/bundle/YouCompleteMe</span><br><span class="line">autocmd InsertLeave * if pumvisible() == 0|pclose|endif "离开插入模式后自动关闭预览窗口"</span><br><span class="line">let g:ycm_collect_identifiers_from_tags_files = 1           " 开启 YCM基于标签引擎</span><br><span class="line">let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全</span><br><span class="line">let g:syntastic_ignore_files=[".*\.py$"]</span><br><span class="line">let g:ycm_seed_identifiers_with_syntax = 1                  " 语法关键字补全</span><br><span class="line">let g:ycm_complete_in_comments = 1</span><br><span class="line">let g:ycm_confirm_extra_conf = 0                            " 关闭加载.ycm_extra_conf.py提示</span><br><span class="line">let g:ycm_key_list_select_completion = ['&lt;c-n&gt;', '&lt;Down&gt;']  " 映射按键,没有这个会拦截掉tab, 导致其他插件的tab不能用.</span><br><span class="line">let g:ycm_key_list_previous_completion = ['&lt;c-p&gt;', '&lt;Up&gt;']</span><br><span class="line">let g:ycm_complete_in_comments = 1                          " 在注释输入中也能补全</span><br><span class="line">let g:ycm_complete_in_strings = 1                           " 在字符串输入中也能补全</span><br><span class="line">let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释和字符串中的文字也会被收入补全</span><br><span class="line">let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'</span><br><span class="line">let g:ycm_show_diagnostics_ui = 0                           " 禁用语法检查</span><br><span class="line">inoremap &lt;expr&gt; &lt;CR&gt; pumvisible() ? "\&lt;C-y&gt;" : "\&lt;CR&gt;"             " 回车即选中当前项</span><br><span class="line">nnoremap &lt;c-j&gt; :YcmCompleter GoToDefinitionElseDeclaration&lt;CR&gt;     " 跳转到定义处</span><br><span class="line">let g:ycm_min_num_of_chars_for_completion=2                 " 从第2个键入字符就开始罗列匹配项</span><br><span class="line">"</span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line">" github 仓库中的插件 "</span><br><span class="line">Plugin 'VundleVim/Vundle.vim'</span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line">Plugin 'vim-airline/vim-airline'</span><br><span class="line">"vim-airline配置:优化vim界面"</span><br><span class="line">"let g:airline#extensions#tabline#enabled = 1</span><br><span class="line">" airline设置</span><br><span class="line">" 显示颜色</span><br><span class="line">set t_Co=256</span><br><span class="line">set laststatus=2</span><br><span class="line">" 使用powerline打过补丁的字体</span><br><span class="line">let g:airline_powerline_fonts = 1</span><br><span class="line">" 开启tabline</span><br><span class="line">let g:airline#extensions#tabline#enabled = 1</span><br><span class="line">" tabline中当前buffer两端的分隔字符</span><br><span class="line">let g:airline#extensions#tabline#left_sep = ' '</span><br><span class="line">" tabline中未激活buffer两端的分隔字符</span><br><span class="line">let g:airline#extensions#tabline#left_alt_sep = ' '</span><br><span class="line">" tabline中buffer显示编号</span><br><span class="line">let g:airline#extensions#tabline#buffer_nr_show = 1</span><br><span class="line">" 映射切换buffer的键位</span><br><span class="line">nnoremap [b :bp&lt;CR&gt;</span><br><span class="line">nnoremap ]b :bn&lt;CR&gt;</span><br><span class="line">" 映射&lt;leader&gt;num到num buffer</span><br><span class="line">map &lt;leader&gt;1 :b 1&lt;CR&gt;</span><br><span class="line">map &lt;leader&gt;2 :b 2&lt;CR&gt;</span><br><span class="line">map &lt;leader&gt;3 :b 3&lt;CR&gt;</span><br><span class="line">map &lt;leader&gt;4 :b 4&lt;CR&gt;</span><br><span class="line">map &lt;leader&gt;5 :b 5&lt;CR&gt;</span><br><span class="line">map &lt;leader&gt;6 :b 6&lt;CR&gt;</span><br><span class="line">map &lt;leader&gt;7 :b 7&lt;CR&gt;</span><br><span class="line">map &lt;leader&gt;8 :b 8&lt;CR&gt;</span><br><span class="line">map &lt;leader&gt;9 :b 9&lt;CR&gt;</span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line">" vim-scripts 中的插件 "</span><br><span class="line">Plugin 'taglist.vim'</span><br><span class="line">"ctags 配置:F3快捷键显示程序中的各种tags，包括变量和函数等。</span><br><span class="line">map &lt;F3&gt; :TlistToggle&lt;CR&gt;</span><br><span class="line">let Tlist_Use_Right_Window=1</span><br><span class="line">let Tlist_Show_One_File=1</span><br><span class="line">let Tlist_Exit_OnlyWindow=1</span><br><span class="line">let Tlist_WinWidt=25</span><br><span class="line"> </span><br><span class="line">Plugin 'The-NERD-tree'</span><br><span class="line">"NERDTree 配置:F2快捷键显示当前目录树</span><br><span class="line">map &lt;F2&gt; :NERDTreeToggle&lt;CR&gt;</span><br><span class="line">let NERDTreeWinSize=25 </span><br><span class="line"> </span><br><span class="line">Plugin 'indentLine.vim'</span><br><span class="line">Plugin 'delimitMate.vim'</span><br><span class="line"> </span><br><span class="line">" 非 github 仓库的插件"</span><br><span class="line">" Plugin 'git://git.wincent.com/command-t.git'</span><br><span class="line">" 本地仓库的插件 "</span><br><span class="line"> </span><br><span class="line">call vundle#end()</span><br><span class="line"> </span><br><span class="line">"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br><span class="line">"""""新文件标题</span><br><span class="line">""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br><span class="line">"新建.c,.h,.sh,.java文件，自动插入文件头 </span><br><span class="line">autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()" </span><br><span class="line">""定义函数SetTitle，自动插入文件头 </span><br><span class="line">func SetTitle() </span><br><span class="line">	"如果文件类型为.sh文件 </span><br><span class="line">	if &amp;filetype == 'sh' </span><br><span class="line">		call setline(1, "##########################################################################") </span><br><span class="line">		call append(line("."), "# File Name: ".expand("%")) </span><br><span class="line">		call append(line(".")+1, "# Author: amoscykl") </span><br><span class="line">		call append(line(".")+2, "# mail: amoscykl980629@163.com") </span><br><span class="line">		call append(line(".")+3, "# Created Time: ".strftime("%c")) </span><br><span class="line">		call append(line(".")+4, "#########################################################################") </span><br><span class="line">		call append(line(".")+5, "#!/bin/zsh")</span><br><span class="line">		call append(line(".")+6, "PATH=/home/edison/bin:/home/edison/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/work/tools/gcc-3.4.5-glibc-2.3.6/bin")</span><br><span class="line">		call append(line(".")+7, "export PATH")</span><br><span class="line">		call append(line(".")+8, "")</span><br><span class="line">	else </span><br><span class="line">		call setline(1, "/*************************************************************************") </span><br><span class="line">		call append(line("."), "	&gt; File Name: ".expand("%")) </span><br><span class="line">		call append(line(".")+1, "	&gt; Author: amoscykl") </span><br><span class="line">		call append(line(".")+2, "	&gt; Mail: amoscykl@163.com ") </span><br><span class="line">		call append(line(".")+3, "	&gt; Created Time: ".strftime("%c")) </span><br><span class="line">		call append(line(".")+4, " ************************************************************************/") </span><br><span class="line">		call append(line(".")+5, "")</span><br><span class="line">	endif</span><br><span class="line">	if &amp;filetype == 'cpp'</span><br><span class="line">		call append(line(".")+6, "#include&lt;iostream&gt;")</span><br><span class="line">    	call append(line(".")+7, "using namespace std;")</span><br><span class="line">		call append(line(".")+8, "")</span><br><span class="line">	endif</span><br><span class="line">	if &amp;filetype == 'c'</span><br><span class="line">		call append(line(".")+6, "#include&lt;stdio.h&gt;")</span><br><span class="line">		call append(line(".")+7, "")</span><br><span class="line">	endif</span><br><span class="line">	"	if &amp;filetype == 'java'</span><br><span class="line">	"		call append(line(".")+6,"public class ".expand("%"))</span><br><span class="line">	"		call append(line(".")+7,"")</span><br><span class="line">	"	endif</span><br><span class="line">	"新建文件后，自动定位到文件末尾</span><br><span class="line">	autocmd BufNewFile * normal G</span><br><span class="line">endfunc </span><br><span class="line">""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br><span class="line">"键盘命令</span><br><span class="line">""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br><span class="line"> </span><br><span class="line">nmap &lt;leader&gt;w :w!&lt;cr&gt;</span><br><span class="line">nmap &lt;leader&gt;f :find&lt;cr&gt;</span><br><span class="line"> </span><br><span class="line">" 映射全选+复制 ctrl+a</span><br><span class="line">map &lt;C-A&gt; ggVGY</span><br><span class="line">map! &lt;C-A&gt; &lt;Esc&gt;ggVGY</span><br><span class="line">map &lt;F12&gt; gg=G</span><br><span class="line">" 选中状态下 Ctrl+c 复制</span><br><span class="line">vmap &lt;C-c&gt; "+y</span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line">""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br><span class="line">""实用设置</span><br><span class="line">"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br><span class="line">" 设置当文件被改动时自动载入</span><br><span class="line">set autoread</span><br><span class="line">" quickfix模式</span><br><span class="line">autocmd FileType c,cpp map &lt;buffer&gt; &lt;leader&gt;&lt;space&gt; :w&lt;cr&gt;:make&lt;cr&gt;</span><br><span class="line">"代码补全 </span><br><span class="line">set completeopt=preview,menu </span><br><span class="line">"允许插件  </span><br><span class="line">filetype plugin on</span><br><span class="line">"共享剪贴板  </span><br><span class="line">set clipboard=unnamed </span><br><span class="line">"从不备份  </span><br><span class="line">set nobackup</span><br><span class="line">"make 运行</span><br><span class="line">:set makeprg=g++\ -Wall\ \ %</span><br><span class="line">"自动保存</span><br><span class="line">set autowrite</span><br><span class="line">set ruler                   " 打开状态栏标尺</span><br><span class="line">set cursorline              " 突出显示当前行</span><br><span class="line">set magic                   " 设置魔术</span><br><span class="line">set guioptions-=T           " 隐藏工具栏</span><br><span class="line">set guioptions-=m           " 隐藏菜单栏</span><br><span class="line">"set statusline=\ %&lt;%F[%1*%M%*%n%R%H]%=\ %y\ %0(%&#123;&amp;fileformat&#125;\ %&#123;&amp;encoding&#125;\ %c:%l/%L%)\</span><br><span class="line">" 设置在状态行显示的信息</span><br><span class="line">set foldcolumn=0</span><br><span class="line">set foldmethod=indent </span><br><span class="line">set foldlevel=3 </span><br><span class="line">set foldenable              " 开始折叠</span><br><span class="line">" 不要使用vi的键盘模式，而是vim自己的</span><br><span class="line">set nocompatible</span><br><span class="line">" 语法高亮</span><br><span class="line">set syntax=on</span><br><span class="line">" 去掉输入错误的提示声音</span><br><span class="line">set noeb</span><br><span class="line">" 在处理未保存或只读文件的时候，弹出确认</span><br><span class="line">set confirm</span><br><span class="line">" 自动缩进</span><br><span class="line">set autoindent</span><br><span class="line">set cindent</span><br><span class="line">" Tab键的宽度</span><br><span class="line">set tabstop=4</span><br><span class="line">" 统一缩进为4</span><br><span class="line">set softtabstop=4</span><br><span class="line">set shiftwidth=4</span><br><span class="line">" 不要用空格代替制表符</span><br><span class="line">set noexpandtab</span><br><span class="line">" 在行和段开始处使用制表符</span><br><span class="line">set smarttab</span><br><span class="line">" 显示行号</span><br><span class="line">set number</span><br><span class="line">" 历史记录数</span><br><span class="line">set history=1000</span><br><span class="line">"禁止生成临时文件</span><br><span class="line">set nobackup</span><br><span class="line">set noswapfile</span><br><span class="line">"搜索忽略大小写</span><br><span class="line">set ignorecase</span><br><span class="line">"搜索逐字符高亮</span><br><span class="line">set hlsearch</span><br><span class="line">set incsearch</span><br><span class="line">"行内替换</span><br><span class="line">set gdefault</span><br><span class="line">"编码设置</span><br><span class="line">set enc=utf-8</span><br><span class="line">set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936</span><br><span class="line">"语言设置</span><br><span class="line">set langmenu=zh_CN.UTF-8</span><br><span class="line">set helplang=cn</span><br><span class="line">" 我的状态行显示的内容（包括文件类型和解码）</span><br><span class="line">set statusline=%F%m%r%h%w\ [FORMAT=%&#123;&amp;ff&#125;]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %&#123;strftime(\"%d/%m/%y\ -\ %H:%M\")&#125;</span><br><span class="line">set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%]</span><br><span class="line">" 总是显示状态行</span><br><span class="line">set laststatus=2</span><br><span class="line">" 命令行（在状态行下）的高度，默认为1，这里是2</span><br><span class="line">set cmdheight=2</span><br><span class="line">" 侦测文件类型</span><br><span class="line">filetype on</span><br><span class="line">" 载入文件类型插件</span><br><span class="line">filetype plugin on</span><br><span class="line">" 为特定文件类型载入相关缩进文件</span><br><span class="line">filetype indent on</span><br><span class="line">" 保存全局变量</span><br><span class="line">set viminfo+=!</span><br><span class="line">" 带有如下符号的单词不要被换行分割</span><br><span class="line">set iskeyword+=_,$,@,%,#,-</span><br><span class="line">" 字符间插入的像素行数目</span><br><span class="line">set linespace=0</span><br><span class="line">" 增强模式中的命令行自动完成操作</span><br><span class="line">set wildmenu</span><br><span class="line">" 使回格键（backspace）正常处理indent, eol, start等</span><br><span class="line">set backspace=2</span><br><span class="line">" 允许backspace和光标键跨越行边界</span><br><span class="line">set whichwrap+=&lt;,&gt;,h,l</span><br><span class="line">" 可以在buffer的任何地方使用鼠标（类似office中在工作区双击鼠标定位）</span><br><span class="line">set mouse=a</span><br><span class="line">set selection=exclusive</span><br><span class="line">set selectmode=mouse,key</span><br><span class="line">" 通过使用: commands命令，告诉我们文件的哪一行被改变过</span><br><span class="line">set report=0</span><br><span class="line">" 在被分割的窗口间显示空白，便于阅读</span><br><span class="line">set fillchars=vert:\ ,stl:\ ,stlnc:\</span><br><span class="line">" 高亮显示匹配的括号</span><br><span class="line">set showmatch</span><br><span class="line">" 匹配括号高亮的时间（单位是十分之一秒）</span><br><span class="line">set matchtime=1</span><br><span class="line">" 光标移动到buffer的顶部和底部时保持3行距离</span><br><span class="line">set scrolloff=3</span><br><span class="line">" 为C程序提供自动缩进</span><br><span class="line">set smartindent</span><br><span class="line">" 高亮显示普通txt文件（需要txt.vim脚本）</span><br><span class="line"> au BufRead,BufNewFile *  setfiletype txt</span><br><span class="line">"自动补全</span><br><span class="line">:inoremap ( ()&lt;ESC&gt;i</span><br><span class="line">:inoremap ) &lt;c-r&gt;=ClosePair(')')&lt;CR&gt;</span><br><span class="line">":inoremap &#123; &#123;&lt;CR&gt;&#125;&lt;ESC&gt;O</span><br><span class="line">":inoremap &#125; &lt;c-r&gt;=ClosePair('&#125;')&lt;CR&gt;</span><br><span class="line">:inoremap [ []&lt;ESC&gt;i</span><br><span class="line">:inoremap ] &lt;c-r&gt;=ClosePair(']')&lt;CR&gt;</span><br><span class="line">:inoremap " ""&lt;ESC&gt;i</span><br><span class="line">:inoremap ' ''&lt;ESC&gt;i</span><br><span class="line">function! ClosePair(char)</span><br><span class="line">	if getline('.')[col('.') - 1] == a:char</span><br><span class="line">		return "\&lt;Right&gt;"</span><br><span class="line">	else</span><br><span class="line">		return a:char</span><br><span class="line">	endif</span><br><span class="line">endfunction</span><br><span class="line">filetype plugin indent on </span><br><span class="line">"打开文件类型检测, 加了这句才可以用智能补全</span><br><span class="line">set completeopt=longest,menu</span><br><span class="line">"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br></pre></td></tr></table></figure>
<p>还差最后一步，要下载这些插件进来</p>
<h4 id="直接输入vim进去"><a href="#直接输入vim进去" class="headerlink" title="直接输入vim进去"></a>直接输入vim进去</h4><p>输入</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">:PluginInstall</span><br></pre></td></tr></table></figure>
<p>命令，等待它下载安装配置文件中的插件，然后会出现</p>
<p><img src="/2018/12/20/Linux上不得不会的Vim使用及配置/clipboard1.png" alt="img"></p>
<p>ok了，这个时候代表已经生效了</p>
<p>那么我们重复上面最开始的步骤新建一个文件来感受一下vim了</p>
<h4 id="最终效果"><a href="#最终效果" class="headerlink" title="最终效果"></a>最终效果</h4><p><img src="/2018/12/20/Linux上不得不会的Vim使用及配置/clipboard2.png" alt="img"></p>
<p>全命令行，说实话和图形图画的IDE根本没法比，完全不能用鼠标，但是看起来吊啊，部分的需要远程修改服务器上面的东西的时候还是挺方便的。</p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/vim/" rel="tag"># vim</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/12/19/Maven私有仓库的搭建及使用/" rel="next" title="Maven私有仓库的搭建及使用">
                <i class="fa fa-chevron-left"></i> Maven私有仓库的搭建及使用
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/01/03/SpringBoot01-构建第一个SpringBoot工程/" rel="prev" title="SpringBoot01--构建第一个SpringBoot工程">
                SpringBoot01--构建第一个SpringBoot工程 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">晓远</p>
              <p class="site-description motion-element" itemprop="description">这个一个关于博客的个人网站</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">51</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">3</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">37</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-4"><a class="nav-link" href="#简述"><span class="nav-number">1.</span> <span class="nav-text">简述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#首先要配置bundel的管理工具"><span class="nav-number">2.</span> <span class="nav-text">首先要配置bundel的管理工具</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#下一步编写我们配置文件"><span class="nav-number">3.</span> <span class="nav-text">下一步编写我们配置文件</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#直接输入vim进去"><span class="nav-number">4.</span> <span class="nav-text">直接输入vim进去</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#最终效果"><span class="nav-number">5.</span> <span class="nav-text">最终效果</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-snowflake-o"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">晓远</span>

  
</div>









        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
